package ro.unibuc.nautilus.controllers.editors;

import java.beans.PropertyEditorSupport;

import org.springframework.beans.factory.annotation.Required;

import ro.unibuc.nautilus.service.EmployeesService;

public class EmployeePropertyEditor extends PropertyEditorSupport {
	private EmployeesService employeesService;

	@Override
    public void setAsText(String text) throws IllegalArgumentException {
        Long employeeId = new Long(text);
        setValue(employeesService.findEmployee(employeeId));
    }
	
	@Required
	public void setEmployeesService(EmployeesService employeesService) {
		this.employeesService = employeesService;
	}

}
